package com.crlclr.data.qzone
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.utils.ByteArray;

	public class QQAlbumXMLLoader extends URLLoader
	{		
		public var albumList:Array;
		public var qqcode:String;
		public function QQAlbumXMLLoader()
		{
			super();
			this.dataFormat=URLLoaderDataFormat.BINARY;
			this.addEventListener(Event.COMPLETE,completeHandler);
		}
	
		
		
		private function completeHandler(event:Event):void{
			this.removeEventListener(Event.COMPLETE,completeHandler);
			
			this.albumList=new Array();
			var bytes:ByteArray=this.data;
			var xml:XML=new XML(bytes.readMultiByte(bytes.bytesAvailable, "gb2312"));
			
			var albums:XMLList=xml.album;
			
			var album:AlbumVO;
			for each(var albumData:XML in albums){
				album=new AlbumVO();
				album.bindXML(albumData);
				
				this.albumList.push(album);
			}
		}
		
	}
}